Skip to content

fix(permissions): handle None response from ACP request_permission#13457

Merged
teknium1 merged 1 commit intoNousResearch:mainfrom
aniruddhaadak80:fix-acp-permission-none
Apr 21, 2026
Merged

fix(permissions): handle None response from ACP request_permission#13457
teknium1 merged 1 commit intoNousResearch:mainfrom
aniruddhaadak80:fix-acp-permission-none

Conversation

@aniruddhaadak80
Copy link
Copy Markdown
Contributor

@aniruddhaadak80 aniruddhaadak80 commented Apr 21, 2026

What does this PR do?

This PR hardens the ACP ? Hermes permission-approval bridge by safely handling an unexpected None result from
equest_permission, preventing attribute errors and defaulting to a safe deny.

Related Issue

Fixes #13449

Type of Change

  • ?? Bug fix (non-breaking change that fixes an issue)
  • ? New feature (non-breaking change that adds functionality)
  • ?? Security fix
  • ?? Documentation update
  • ? Tests (adding or improving test coverage)
  • ?? Refactor (no behavior change)
  • ?? New skill (bundled or hub)

Changes Made

  • Return "deny" when
    equest_permission resolves to None in the approval callback.
  • Add a unit test covering the None response case to ensure the callback denies safely.

How to Test

  1. Connect via an ACP client that sends an empty response to permission requests.
  2. Verify the permission is denied rather than throwing an exception.

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) � or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys � or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows � or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide � or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior � or N/A

Copilot AI review requested due to automatic review settings April 21, 2026 10:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens the ACP → Hermes permission-approval bridge by safely handling an unexpected None result from request_permission, preventing attribute errors and defaulting to a safe deny.

Changes:

  • Return "deny" when request_permission resolves to None in the approval callback.
  • Add a unit test covering the None response case to ensure the callback denies safely.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
acp_adapter/permissions.py Adds an explicit guard for None permission responses, defaulting to deny.
tests/acp/test_permissions.py Adds regression coverage to ensure None responses produce "deny".

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

logger.warning("Permission request timed out or failed: %s", exc)
return "deny"

if response is None:
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

response is None is handled by returning "deny", but it fails silently. If None represents an unexpected/invalid ACP reply, consider logging (at least debug/warning) or adding a short comment explaining why None is an expected value, so diagnosing permission-bridge issues is easier in production.

Suggested change
if response is None:
if response is None:
logger.warning(
"Permission request returned no response; denying by default "
"(session_id=%s, command=%r)",
session_id,
command,
)

Copilot uses AI. Check for mistakes.
Comment on lines +66 to +67
if response is None:
return "deny"
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR description still contains template placeholders (e.g., Fixes #, empty Changes Made / How to Test). Please fill these in so reviewers and release notes can trace the bug report and verify the reproduction + fix steps.

Copilot uses AI. Check for mistakes.
@teknium1 teknium1 merged commit ea06104 into NousResearch:main Apr 21, 2026
9 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ACP permission bridge crashes when request_permission() returns None

3 participants